/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.mahumLogs.utils;

import java.io.Serializable;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 *
 * @author Kalast
 */
public class LogsFile implements Serializable {
    private Date startTimestamp;
    private Date endTimestamp;
    private String filename;
    private String path;
    private int nbLignes;
    private int nbLigneInsertDB;

    public LogsFile() {
    }

    public LogsFile(int nbLignes, Date startTimestamp, Date endTimestamp, String filename, String path) {
        this.startTimestamp = startTimestamp;
        this.endTimestamp = endTimestamp;
        this.filename = filename;
        this.path = path;
        this.nbLignes = nbLignes;
    }
    
    public float getAvancement(){
        return ((float)nbLigneInsertDB / (float)nbLignes) * 100f;
    }
    
    public void resetNbLigneInsertDB(){
        this.nbLigneInsertDB = 0;
    }

    public void setNbLigneInsertDB(int nbLigneInsertDB) {
        this.nbLigneInsertDB = nbLigneInsertDB;
    }
    
    public void incrementNbLigneInsertDB(){
        this.nbLigneInsertDB ++;
    }

    public int getNbLignes() {
        return nbLignes;
    }

    public void setNbLignes(int nbLignes) {
        this.nbLignes = nbLignes;
    }

    public Date getStartTimestamp() {
        return startTimestamp;
    }
    
    public String getStartDate() {
        DateFormat df = new SimpleDateFormat("dd/MM/yyyy à H:mm:ss");
        return df.format(startTimestamp);
    }
    
    public String getEndDate() {
        DateFormat df = new SimpleDateFormat("dd/MM/yyyy à H:mm:ss");
        return df.format(endTimestamp);
    }

    public void setStartTimestamp(Date startTimestamp) {
        this.startTimestamp = startTimestamp;
    }

    public Date getEndTimestamp() {
        return endTimestamp;
    }

    public void setEndTimestamp(Date endTimestamp) {
        this.endTimestamp = endTimestamp;
    }

    public String getFilename() {
        return filename;
    }

    public void setFilename(String filename) {
        this.filename = filename;
    }

    public int getNbLigneInsertDB() {
        return nbLigneInsertDB;
    }
    
    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }
}
